package com.chixing.ih.util;

import java.util.UUID;

/**
 * @author 刘岩
 * @version 1.0
 * @Desc Practice makes perfect
 * @date 2020/9/11 18:37
 */
public class UUIDUtil {

    public static String get32UUID() {
        return UUID.randomUUID().toString();
    }

    public static String get16UUId() {
        int machineId = 1;
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {//有可能是负数
            hashCodeV = -hashCodeV;
        }
        return machineId + String.format("%015d", hashCodeV);
    }
}
